package com.loanapp.server.user.api.user.api;


import com.baomidou.mybatisplus.plugins.Page;
import com.loanapp.base.common.exception.BusinessException;
import com.loanapp.server.user.api.user.entity.User;
import com.loanapp.server.user.api.user.hystrix.UserHystrix;
import com.loanapp.server.user.api.user.query.UserQuery;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.*;

@FeignClient(value = "loanapp-server-user-provider",fallback = UserHystrix.class)
public interface UserApi {
    @RequestMapping(value = "/user/getUser/{id}", method = RequestMethod.POST)
    public User getUser(@PathVariable("id") Long id) throws BusinessException;

    @RequestMapping(value = "/user/insert", method = RequestMethod.POST)
    public Long insert(@RequestBody User user) throws BusinessException;

    @RequestMapping(value = "/user/getUserQuery",method = RequestMethod.POST)
    public User selectByQuery(@RequestBody UserQuery query) throws BusinessException ;

    @RequestMapping(value = "/user/delete/{id}",method = RequestMethod.POST)
    public Boolean del(@PathVariable("id") Long id) throws BusinessException;

    @RequestMapping(value = "/user/update",method = RequestMethod.POST)
    public Boolean update(@RequestBody User user) throws BusinessException;

    @PostMapping("getListPage")
    public Page<User> getListPage(@RequestBody UserQuery userQuery) throws BusinessException;
}
